package com.yanqu.road.server.cmd.grandchild;

import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.pb.grandchild.GrandChildProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.grandchild.GrandChildMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C_GRAND_CHILD_GET_EXAM_CONFIG, desc = "获取科举配置")
public class CrossGetExamConfigCmd extends CrossCommand {

    private long userId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        userId = packet.getPlayerId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        GrandChildProto.GrandChildSyncExamGroupRespMsg.Builder examConfigMsg = GrandChildMgr.getExamConfigMsg(serverId);
        // 返回
        YanQuMessage message = YanQuMessageUtils.buildMessage(ClientProtocol.U_GRAND_CHILD_SYNC_EXAM_GROUP, examConfigMsg);
        MessageHelper.sendPacket(serverId, userId, message);
    }

    @Override
    public void sendData() {

    }
}
